/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.ipo.mm.ejb.facade.type;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.ipo.mm.ejb.entities.Institution;
import org.ipo.mm.ejb.entities.InstitutionType;

/**
 *
 * @author makcro
 */
@Stateless
public class InstitutionTypeFacade implements InstitutionTypeFacadeLocal, InstitutionTypeFacadeRemote {
    @PersistenceContext
    private EntityManager em;

    public void create(InstitutionType institutionType) {
        em.persist(institutionType);
    }

    public void edit(InstitutionType institutionType) {
        em.merge(institutionType);
    }

    public void remove(InstitutionType institutionType) {
        em.remove(em.merge(institutionType));
    }

    public InstitutionType find(Object id) {
        return em.find(InstitutionType.class, id);
    }

    public List<InstitutionType> findAll() {
        return em.createNamedQuery("InstitutionType.findAll").getResultList();
    }

    public void refresh(InstitutionType itype){
        em.refresh(itype);
    }
}
